<template>
  <div class="home-block-wrap">
    <div class="home-block-title">
      <img v-if="titleIcon" :src="titleIcon"/>
      <span>{{title}}</span>
    </div>
    <div class="home-block-content">
      <div class="left" :style="{flex: `0 0 ${leftWidth}px`}">
        <slot name="left"></slot>
      </div>
      <div class="right">
        <slot name="right"></slot>
      </div>
      <div class="default">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomeBlock',
  props: {
    // 标题的icon
    titleIcon: {
      type: String,
      default: ''
    },
    // 标题
    title: {
      type: String,
      default: ''
    },
    leftWidth: {
      type: Number,
      default: 200
    }
  }
};
</script>

<style lang="less" scoped>
  .home-block-wrap {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    background-color: #fff;
    .home-block-title {
      height: 30px;
      line-height: 30px;
      padding: 0 10px;
      font-size: 16px;
      border-bottom: 1px solid #ddd;
    }
    .home-block-content {
      display: flex;
      padding: 20px 20px 10px 20px;
      .left {
        flex: 0 0 200px;
        padding-right: 10px;
        border-right: 1px solid #ddd;
      }
      .right {
        flex: 1;
        padding-left: 20px;
      }
    }
  }
</style>
